-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Add SpawnableList implementation for adding multiple entities per iteration
#21637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, not convinced
|
It looks like your PR has been selected for a highlight in the next release blog post, but you didn't provide a release note. Please review the instructions for writing release notes, then expand or revise the content in the release notes directory to showcase your changes. |
|
Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke! If it's expected, please add the M-Deliberate-Rendering-Change label. If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it. |
Objective
When working with complex spawn hierarchies, it can sometimes be useful to spawn multiple for each object in a list. I encountered this, when using bevy_enhanced_input. Consider the following scenario:
If the bindings didn't have a known size, this would not be possible without a
FlatSpawnVec.Solution
This can be solved by using a
FlatSpawnVecimplementation that spawns multiple entities per iteration. I could also see the vector being changed in favor of an iterator or similar.Testing
I added a test
bevy_ecs::spawn::test::flat_spawn_vec